package hxg;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author HeXiangGuang
 * @create 2021-01-09 22:13
 */
public class charTest {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入学号：");
            String number = input.next();
        char[] array = number.toCharArray();
        int[] intNumber = new int[array.length];
        //char类型的数组转换为int整型数组
        for (int i = 0; i <array.length ; i++) {
            intNumber[i] = Integer.parseInt(String.valueOf(array[i]));
        }
        System.out.println("遍历的学号是下面的值：");
        for (int numbers:intNumber) {
            System.out.println(numbers);
        }
        //排序
        System.out.println("增序排序后顺序");
        Arrays.sort(intNumber);
        for (int i=0;i<intNumber.length;i++)
        {
            System.out.print(intNumber[i]+" ");
        }
    }
}
